package com.menu.Service.Impl;

import com.menu.Mapper.DohMapper;
import com.menu.Pojo.Doh;
import com.menu.Service.DohService;
import com.menu.Utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class DohServiceImpl implements DohService {
    @Resource
    DohMapper dohMapper;


    @Override
    public ResponseResult addDoh(Integer userId, Integer menuId) {
        Doh doh= dohMapper.findByUserIdAndMenuId(userId, menuId);
        if(doh!=null){
            return ResponseResult.success("已经浏览过",0);
        }else{
            dohMapper.addDoh(userId, menuId);
            return ResponseResult.success("该菜单浏览量加一",1);
        }
    }


}
